<template>
  <div class="panel left-panel" :style="{
      width: width + 'px'
  }">
      <div class="panel-tabs">
          <button class="tab-button" :class="{ active: activeTab === 'files' }" @click="activeTab = 'files'">
              文件
          </button>
          <button class="tab-button" :class="{ active: activeTab === 'outline' }" @click="activeTab = 'outline'">
              大纲
          </button>
      </div>

      <div class="panel-content">
          <div v-if="activeTab === 'files'">
              <File />
          </div>

          <div v-if="activeTab === 'outline'">
              <DaGang />
          </div>
      </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import File from '@/components/index-left-s/index-file/index.vue'
import DaGang from '@/components/index-left-s/index-dagang/index.vue'

const props = defineProps({
  width: {
    type: Number,
    required: true
  }
})

const emit = defineEmits(['resize-start', 'update:width'])

const activeTab = ref('files')
</script>

<style scoped>
.panel {
  position: relative;
  background-color: #f0f2f5;
  border-right: 1px solid #dcdfe6;
  transition: width 0.3s ease;
  overflow: hidden;
  flex-shrink: 0;
  height: 100%;
}

.panel-tabs {
  display: flex;
  border-bottom: 1px solid #ddd;
}

.tab-button {
  flex: 1;
  padding: 8px 12px;
  background: #f5f5f5;
  border: none;
  border-right: 1px solid #ddd;
  cursor: pointer;
  outline: none;
}

.tab-button:last-child {
  border-right: none;
}

.tab-button.active {
  background: #fff;
  font-weight: bold;
  border-bottom: 2px solid #1890ff;
}

.panel-content {
  padding: 20px;
  height: 100%;
  box-sizing: border-box;
  overflow: auto;
  /* width: 100%; */
}

.resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 5px;
  background-color: #dcdfe6;
  cursor: col-resize;
  z-index: 10;
}

.right-handle {
  right: 0;
}

.resize-handle:hover {
  background-color: #409eff;
}
</style>
